/**************************************************************************(C)*
 *
 *  This file is part of the GreenHills project
 *  Copyright (C) 2009  Tieto Corporation
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  Not for commmercial use. Only with Tieto permission.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************(C)*/

#pragma once

#include <QString>
#include "gpsdll.h"

namespace greenhills {
namespace gps {

/** @brief Encapsulation of GPS fix
 *
 * This class encapsulates GPS fix which express validity of values provided
 * by GPS receiver.
 */
class GH_GPS_CLASS CGPSFix
{
public:
    /**
     * @brief Internal representation of GPS fix values
     */
    enum eGPSfix
    {
        //! GPS Fix is not valid
        Invalid = 0,
        //! GPS Fix is valid
        GPSfix = 1,
        //! DGPS Fix is valid
        DGPSfix = 2,
    };

public:
    /**
     * @brief Creates empty CGPSFix object
     */
    CGPSFix();

    /**
     * @brief Creates CGPSFix object with given GPS fix value
     * values.
     */
    CGPSFix(eGPSfix fix);

public:
    /**
     * @brief Returns GPS fix value in eGPSfix format
     */
    eGPSfix fix() const { return mFix;}

    /**
     * @brief Returns GPS fix value in eGPSfix format
     */
    operator eGPSfix() const { return mFix; }

    /**
     * @brief Returns true if GPS fix is valid
     */
    bool isValid() const { return mFix != CGPSFix::Invalid;}

public:
    /**
     * @brief Returns GPS fix value explanation in human readable string format
     */
    QString toString() const;

private:
    eGPSfix mFix;
};

} //namespace gps
} //namespace greenhills
